@extends('admin::layouts.master')
@section('content')
    <div class="col-lg-12">
        <div class="card card-flat">
            <div class="card-header">为用户[{{$admin['nickname']}}]分配角色</div>
            <div class="card-body">
                <form action="/admin/addrole/{{$admin['id']}}" method="post">
                    @csrf
                <div class="form-group row pt-1 pb-1">
                    <div class="col-12 col-sm-8 col-lg-6 form-check mt-2">
                        @foreach($roles as $role)
                        <label class="custom-control custom-checkbox custom-control-inline">
                            <input type="checkbox" class="custom-control-input" value="{{$role['name']}}" name="name[]" {{$admin->hasRole($role['name'])?'checked':''}}><span class="custom-control-label">{{$role['title']}}</span>
                        </label>
                        @endforeach
                    </div>
                </div>
                <button type="submit" class="btn btn-primary">保存</button>
                </form>
            </div>
        </div>
    </div>
@endsection